import request from '@/utils/request'

// 工单列表
export const getTaskList = (params) => request({
  url: '/task-service/task/search',
  params
})
// 创建工单
export const addTask = ({ createType = 1, assignorId, innerCode, userId, productType, desc, details = {}}) => request({
  url: '/task-service/task/create',
  method: 'POST',
  data: {
    createType, innerCode, userId, productType, assignorId, desc, details
  }
})
// 获取售货机货道详情 补货详情

export const getTaskDetails = (id) => request({
  url: `/vm-service/channel/channelList/${id}`
})

// 获取补货详情
export const getAddTask = (id) => request({
  url: `/task-service/taskDetails/${id}`
})

// 获取补货预警值

export const getSupplyValue = () => request({
  url: '/task-service/task/supplyAlertValue'
})

// 设置自动补货工单阈值
export const setSupplyValue = (alertValue) => request({
  url: '/task-service/task/autoSupplyConfig',
  method: 'POST',
  data: {
    alertValue: alertValue
  }
})
// 取消工单
export const cancleTask = (data) => request({
  url: `/task-service/task/cancel/${data.taskId}`,
  method: 'POST',
  data: {
    taskId: data.taskId,
    desc: data.desc
  }
})
// 获取工单列表
export const taskList = (alertValue) => request({
  url: '/task-service/taskType/list',
  data: {
    alertValue: alertValue
  }
})

// 工单状态统计

export const orderStatus = (start, end) => request({
  url: `/task-service/task/collectReport/${start}/${end}`
})
